from sqlalchemy.dialects.mysql import INTEGER, VARCHAR,JSON,DOUBLE
from sqlalchemy import Column
from sqlalchemy.ext.declarative import declarative_base

from pydantic import BaseModel, ValidationError, validator
Base = declarative_base()


class EquipmentSensorTable(Base):
    __tablename__ = 'equipment_sensor'
    id = Column(INTEGER, primary_key=True)

    numbering = Column(VARCHAR(255), nullable=False)
    raster_total = Column(INTEGER, nullable=False)
    equipment_id = Column(INTEGER, nullable=False)
    drill_id = Column(INTEGER, nullable=False)
    raster_data=Column(JSON, nullable=False)
    create_time = Column(INTEGER, default=0)
    update_time = Column(INTEGER, default=0)


class Item(BaseModel):
    numbering: str
    raster_total: int
    drill_id: int
    raster_data:list

class UpdateInfo(BaseModel):
    sensor_id:int
    numbering: str
    raster_total: int
    drill_id: int
    raster_data:list